<!-- project_detail -->
<!-- 用户中心=》用能单位=》项目详情 -->
@include("user.head")
<div class="wrapper">
	<div class="col-xs-12 no_padding_both">
		<ol class="breadcrumb">
	      <li><a href="<%url('')%>">碳银网首页</a></li>
	      <li><a href="<%url('industry')%>">低碳产业</a></li>
	      <li><a href="<%url('industry/project')%>">低碳项目</a></li>
	      <li class="active"><%$model["name"]%></li>
	    </ol>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<div class="col-xs-6 no_padding">
				<img src="<%url('images')%>/<%$model["uid"]%>/project/<%$model["image"]%>" height="440" width="480" alt="">
			</div>
			<div class="col-xs-6">
				<div class="col-xs-12 proritht">
					<%$model["name"]%>
					@if ($model["is_financing"])
						@if ($model["state"] == 0)
							<span class="label label-danger">正在招标中</span>
						@elseif($model["state"] == 1)
							<span class="label label-warning">已确认执行方</span>
						@elseif($model["state"] == 2)
							<span class="label label-success">正在进行中</span>
						@elseif($model["state"] == 3)
							<span class="label label-primary">项目已完成</span>
						@endif
					@endif
				</div>
				<div class="col-xs-12 prorightRice bianju">
					<span class="prorightRice_size">
						<%$model["userData"]["company_name"]%>
					</span>
					<a href="javascript:;" class="fr" ralate='<%$model["id"]%>' id="collect">
						<i @if($isCollect)class="fa fa-star" @else class="fa fa-star-o" @endif  id="collectIcon"></i>收藏
					</a>
					</div>
				<div class="col-xs-12 bianju proContent">
					@if ($model["is_financing"])
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							项目模式:
						</div>
						<div class="col-xs-9">
							<%$model["investment_type"]["name"]%>
						</div>
					</div>
					@endif
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							项目类型:
						</div>
						<div class="col-xs-9">
							@if (count($model["project_domain"]))
							<%$model["project_domain"][0]["domain"]["parent"]["cate_name"]%> <%$model["project_domain"][0]["domain"]["cate_name"]%>
							@endif
						</div>
					</div>
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							所在地:
						</div>
						<div class="col-xs-9">
							<%$model["province"]["area_name"]%> @if ($model["province"]["area_name"] != $model["city"]["area_name"]) <%$model["city"]["area_name"]%> @endif <%$model["area"]["area_name"]%>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							计划启动时间:
						</div>
						<div class="col-xs-9">
							<%format($model["start_time"], "Y-m-d")%>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							计划完成时间:
						</div>
						<div class="col-xs-9">
							<%format($model["end_time"], "Y-m-d")%>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							节能需求:
						</div>
						<div class="col-xs-9">
							@if (isset($model["save_require"]))
								<% mb_substr($model["save_require"], 0, 20) %>
							@endif
						</div>
					</div>
					<div class="col-xs-12">
						<div class="col-xs-3 no_padding_both text-right">
							应用主体:
						</div>
						<div class="col-xs-9">
							@if (isset($model["main_body"]))
								@foreach ($model["main_body"] as $main)
									<span class="label label-primary" style="line-height:inherit;"><%$main["main_body"]["name"]%></span>
								@endforeach
							@endif
						</div>
					</div>
					<div class="col-xs-12">
						@if ($model["state"] == 0 && $isSaver == env("SAVER"))
							<button class="btn btn-primary col-xs-4" style="margin-right:10px;" id="wannaDo">提交意向</button>
						@endif
						@if(!Session::has("user"))
						<button class="btn btn-primary col-xs-4" style="margin-right:10px;" id="wannaDo" onClick="window.location.href='<%url("login")%>'">提交意向</button>
						@endif
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="row no_margin proDetail">
		<ul class="nav nav-tabs">
			<li class="active"><a href="#jieshao" data-toggle="tab" aria-expanded="true">项目介绍</a></li>
			<li class=""><a href="#jingdu" data-toggle="tab" aria-expanded="false">项目进度</a></li>
			<li class=""><a href="#tech" data-toggle="tab" aria-expanded="false">采用的技术</a></li>
			<li class=""><a href="#device" data-toggle="tab" aria-expanded="false">采用的设备</a></li>
			<li class=""><a href="#liebiao" data-toggle="tab" aria-expanded="false">意向机构</a></li>
		</ul>
		<div id="myTabContent" class="tab-content">
		  <div class="tab-pane fade active in" id="jieshao">
		  	<div class="row">
		  		<div class="col-xs-4 proDetail_first">
		  			<div class="col-xs-12">项目名称: <%$model["name"]%></div>
		  			<div class="col-xs-12">是否申请奖励：<%$model["is_request_award"] ? "是" : "否"%></div>
		  			<div class="col-xs-12">改造前：<%$model["transform_before"]%></div>
		  			<div class="col-xs-12">计划启动时间：<%format($model["start_time"], "Y-m-d")%></div>
		  			<div class="col-xs-12">项目模式：<%isset($model["investment_type"]) ? $model["investment_type"]["name"] : "无"%></div>
		  		</div>
		  		<div class="col-xs-4 proDetail_first">
		  			<div class="col-xs-12">项目实施地点：<%$model["province"]["area_name"]%> @if ($model["province"]["area_name"] != $model["city"]["area_name"]) <%$model["city"]["area_name"]%> @endif <%$model["area"]["area_name"]%></div>
		  			<div class="col-xs-12">是否申请补贴：<%$model["is_request_subsidy"] ? "是" : "否"%></div>
		  			<div class="col-xs-12">改造后：<%$model["transform_after"]%></div>
		  			<div class="col-xs-12">计划完成时间：<%format($model["end_time"], "Y-m-d")%></div>
		  			<div class="col-xs-12">用能单位：<%$model["userData"]["company_name"]%></div>
		  		</div>
		  		<div class="col-xs-4 proDetail_first">
		  			<div class="col-xs-12">项目投资规模(万元)：<%$model["investment_scale"]%></div>
		  			<div class="col-xs-12">是否申请退税：<%$model["is_request_rebate"] ? "是" : "否"%></div>
		  			<div class="col-xs-12">节能效果：<%$model["save_effect"]%></div>
		  			<div class="col-xs-12">是否融资：<%$model["is_financing"] ? "是" : "否"%></div>
		  		</div>
		  	</div>
		  	<div class="col-xs-12 project_content" id="content">
	  		</div>
		  </div>
		  <div class="tab-pane fade upMar downMar" id="jingdu">
		  		@if(isset($model["project_progress"]) && count($model["project_progress"]))
				<div class="jindu_content">
			    	<ul class="cbp_tmtimeline">
						@foreach ($model["project_progress"] as $progress)
						<li>
			    		    <time class="cbp_tmtime">
			    		    	<span><%format($progress["progress_time"], "y/m/d")%></span>
			    		    	<span><%format($progress["progress_time"], "H:i")%></span>
			    		    </time>
			    		    <div class="cbp_tmicon cbp_tmicon-screen"></div>
			    		    <div class="cbp_tmlabel">
			    		        <%$progress["content"]%>
			    		    </div>
			    		</li>
						@endforeach
			    	</ul>
		    	</div>
		    	@else
		    		暂无进度情况
		    	@endif
		  	</div>

		  	<div class="tab-pane fade upMar downMar" id="tech">
		  		@if (isset($model["technologies"]) && count($model["technologies"]))
		        <div class="panel panel-default">
					<table class="table">
					<thead>
					  <tr>
					    <th class="col-xs-4 text-center">技术图片</th>
					    <th class="col-xs-4 text-center">技术名称</th>
					    <th class="col-xs-4 text-center">技术描述</th>
					  </tr>
					</thead>
					<tbody>
						@foreach ($model["technologies"] as $technology)
						<tr>
							<td class="col-xs-4 text-center">
								<a href="<%url('industry/tech/detail?tid=')%><%$technology['technology']['id']%>">
									<img src="<%url('images')%>/<%$technology['technology']['uid']%>/<%env('TECH_DIR')%>/<%$technology['technology']['image']%>" width="100">
								</a>
							</td>
							<td class="col-xs-4 text-center">
								<a href="<%url('industry/tech/detail?tid=')%><%$technology['technology']['id']%>">
									<%$technology["technology"]["tech_name"]%>
								</a>
							</td>
							<td class="col-xs-4 text-left">
								<a href="<%url('industry/tech/detail?tid=')%><%$technology['technology']['id']%>">
									<%$technology["technology"]["description"]%>
								</a>
							</td>
						</tr>
						@endforeach
					</tbody>
					</table>
		 		</div>
				@else
				暂无技术使用记录
				@endif
	 		</div>

	 		<div class="tab-pane fade upMar downMar" id="device">
		  		@if (isset($model["devices"]) && count($model["devices"]))
		        <div class="panel panel-default">
					<table class="table">
					<thead>
					  <tr>
					    <th class="col-xs-4 text-center">设备图片</th>
					    <th class="col-xs-4 text-center">设备名称</th>
					    <th class="col-xs-4 text-center">设备说明</th>
					  </tr>
					</thead>
					<tbody>
						@foreach ($model["devices"] as $device)
						<tr>
							<td class="col-xs-4 text-center">
								<a href="<%url('industry/device/detail?did=')%><%$device['device']['id']%>">
									<img src="<%url('images')%>/<%$device['device']['uid']%>/<%env('DEVICE_DIR')%>/<%$device['device']['image']%>" width="100">
								</a>
							</td>
							<td class="col-xs-4 text-center">
								<a href="<%url('industry/device/detail?did=')%><%$device['device']['id']%>">
									<%$device["device"]["name"]%>
								</a>
							</td>
							<td class="col-xs-4 text-left">
								<a href="<%url('industry/device/detail?did=')%><%$device['device']['id']%>">
									<%$device["device"]["description"]%>
								</a>
							</td>
						</tr>
						@endforeach
					</tbody>
					</table>
		 		</div>
				@else
				暂无设备使用记录
				@endif
	 		</div>

	  		<div class="tab-pane fade upMar downMar" id="liebiao">
	  			@if ($isSaver == env("SAVER"))
	  			<div class="col-xs-12" style="margin-bottom:10px;">
	  				<div class="input-group">
						<textarea class="form-control no_padding_both" rows="3" id="desArea" style="padding:10px;"></textarea>
						<span class="input-group-addon btn btn-primary" id="submitDes">提交意向</span>
					</div>
	  			</div>
	  			@endif
		  		<div class="col-xs-12">
		  			@if (isset($model["biddings"]) && count($model["biddings"]))
			        <div class="panel panel-default">
						<table class="table">
						<thead>
						  <tr>
						    <th class="col-xs-4 text-center">公司名称</th>
						    <th class="col-xs-4 text-center">公司介绍</th>
						    <th class="col-xs-4 text-center">说明</th>
						  </tr>
						</thead>
						<tbody>
							@foreach ($model["biddings"] as $bidding)
							<tr>
								<td class="col-xs-4 text-center" style="line-height:30px;">
									<a href="<%url('industry/group/detail?gid=')%><%$bidding['uid']%>">
									<%$bidding["userData"]["company_name"]%>
									</a>
								</td>
								<td class="col-xs-4 text-left" style="line-height:30px;"><%$bidding["userData"]["description"]%></td>
								@if ($bidding["is_chosen"] == 1)
								<td class="col-xs-4 text-center" style="line-height:30px;">
									<i class="fa fa-check-circle" style="color:#00cd22;font-size:30px;"></i> 已确定
								</td>
								@else
									@if (Session::has("user") && (Session::get("user")["id"] == $bidding["user"]["id"] || Session::get("user")["id"] == $model["uid"]))
									<td class="col-xs-4 text-center"><%$bidding["description"]%></td>
									@else
									<td class="col-xs-4 text-center bidding_price">已隐藏</td>
									@endif
								@endif
							</tr>
							@endforeach
						</tbody>
						</table>
			 		</div>
					@else
					暂无意向机构
					@endif
		  		</div>
	 		</div>
		</div>
	</div>
</div>
@include("user.footer")
@include("user.common")
<script type="text/javascript">
$("#content").html(decodeURIComponent('<%$model["content"]%>'));

var pid = '<%$model["id"]%>';

// 添加收藏
$("#collect").bind('click', function(){
	_this = $(this);
	var relate_id = $(this).attr("ralate");
	$.post("<%url('collect/add_collect')%>", {
		type : 0,
		relate_id : relate_id
	}, function (data){
		if(data == 1){
			$("#collectIcon").attr("class", 'fa fa-star');
		}else if(data == 0){
			$("#collectIcon").attr("class", 'fa fa-star-o');
		}
		else{
			window.location.href = "<%url('login')%>";
		}
	})
});

$("#wannaDo").bind("click", function(){
	$(".nav-tabs li").removeClass("active");
	$("#myTabContent .tab-pane").removeClass("active in");
	$(".nav-tabs li").last().addClass("active");
	$("#myTabContent .tab-pane").last().addClass("active in");
	$("#desArea").focus();
});

$("#submitDes").bind("click", function(){
	var txt = $("#desArea").val();
	if(txt.trim() != ""){
		$.post("<%url('industry/project/add_description')%>", {
			pid: pid,
			des: txt
		}, function(data){
			if(data.success){
				$("#desArea").val("");
				success("", "提交成功！");
				setTimeout(function(){
					window.location.reload();
				}, 2000)
			}else{
				error("", data.msg);
			}
		});
	}
});
</script>